<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
cfc('core')->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$item=pdo_get('core_members',array('id'=>$_SESSION['uid']),array('username','nickname','isrealname','realname','mobile','realmobile','cardnum'));
	$item['nickname']=$item['nickname']?:$item['username'];
	$tips='请提交真实姓名，身份证号码！以备顺利完成实名认证！';
	$return['item']=$item;
	$return['tips']=$tips;
	set_html('title','实名认证');
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$postdata['ordersn']='SN'.get_ordersn($this->tablename('log'),'ordersn');
	if(!$postdata['realname'] || !$postdata['cardnum']){
		exi('姓名，身份证号必填！','error');
	}
	$res=$this->model('api')->checkinfo($postdata);
	$postdata['response_data']=$res['Response'];
	$postdata['passed']=$res['Response']['Result']?0:1;
	$this->model('model')->addlog($postdata);
	exi('提交成功！','','goback');
}
if($_RQ['op']=='backurl'){
	$this->model('member')->check_passed($postdata);
	exi('提交成功！');
}